package org.example.utils;

import java.util.Random;
import java.util.UUID;

/**
 * @author: sql
 * @date: 2024/6/7
 * @Description: 生成主键工具类
 * @version: 1.0
 */
public class UUIDUtils {

	public static String getUUID() {
		return UUID.randomUUID().toString().replace("-", "");
	}

	public static String getIntNum(int length) {
		StringBuilder str = new StringBuilder();// 定义变长字符串
		Random random = new Random();
		// 随机生成数字，并添加到字符串
		for (int i = 0; i < length; i++) {
			str.append(random.nextInt(10));
		}
		// 将字符串转换为数字并输出
		return str.toString();
	}

	public static void main(String[] args) {
		getIntNum(8);
	}

}
